home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / QD3DRenderer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  42.7 KB  |  1,293 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DRenderer.h
  3.  
  4.      Contains:    Q3Renderer types and routines                                          
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.1
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DRENDERER__
  19. #define __QD3DRENDERER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24. #ifndef __QD3DSET__
  25. #include <QD3DSet.h>
  26. #endif
  27. #ifndef __QD3DVIEW__
  28. #include <QD3DView.h>
  29. #endif
  30.  
  31. #if TARGET_OS_MAC
  32. #ifndef __EVENTS__
  33. #include <Events.h>
  34. #endif
  35. #endif  /* TARGET_OS_MAC */
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=power
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. #if PRAGMA_ENUM_ALWAYSINT
  60.     #pragma enumsalwaysint on
  61. #elif PRAGMA_ENUM_OPTIONS
  62.     #pragma option enum=int
  63. #elif PRAGMA_ENUM_PACK
  64.     #if __option(pack_enums)
  65.         #define PRAGMA_ENUM_PACK__QD3DRENDERER__
  66.     #endif
  67.     #pragma options(!pack_enums)
  68. #endif
  69.  
  70. /******************************************************************************
  71.  **                                                                             **
  72.  **                            User Interface Things                             **
  73.  **                                                                             **
  74.  *****************************************************************************/
  75. #if TARGET_OS_MAC
  76. /*
  77.  *  A callback to an application's event handling code. This is needed to    
  78.  *  support movable modal dialogs. The dialog's event filter calls this      
  79.  *  callback with events it does not handle.                                 
  80.  *  If an application handles the event it should return kQ3True.            
  81.  *  If the application does not handle the event it must return kQ3False and 
  82.  *  the dialog's event filter will pass the event to the system unhandled.   
  83.  */
  84. typedef CALLBACK_API_C( TQ3Boolean , TQ3MacOSDialogEventHandler )(const EventRecord *event);
  85.  
  86. struct TQ3DialogAnchor {
  87.     TQ3MacOSDialogEventHandler         clientEventHandler;
  88. };
  89. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  90. #elif TARGET_OS_WIN32
  91.  
  92. struct TQ3DialogAnchor {
  93.     HWND                             ownerWindow;
  94. };
  95. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  96. #else
  97.  
  98. struct TQ3DialogAnchor {
  99.     void *                            notUsed;                    /* place holder */
  100. };
  101. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  102. #endif  /* TARGET_OS_WIN32 */
  103.  
  104. /******************************************************************************
  105.  **                                                                             **
  106.  **                            Renderer Functions                                 **
  107.  **                                                                             **
  108.  *****************************************************************************/
  109. EXTERN_API_C( TQ3RendererObject )
  110. Q3Renderer_NewFromType            (TQ3ObjectType             rendererObjectType);
  111.  
  112. EXTERN_API_C( TQ3ObjectType )
  113. Q3Renderer_GetType                (TQ3RendererObject         renderer);
  114.  
  115.  
  116.  
  117. /*
  118.  *    Non-blocking, flush all buffered graphics to rasterizer. May or
  119.  *    may not update the draw context.
  120.  *    
  121.  *    This function has been replaced by Q3View_Flush
  122.  */
  123. EXTERN_API_C( TQ3Status )
  124. Q3Renderer_Flush                (TQ3RendererObject         renderer,
  125.                                  TQ3ViewObject             view);
  126.  
  127. /*
  128.  *    Blocking, flush all buffered graphics to rasterizer and update
  129.  *    draw context.
  130.  *    
  131.  *    This function has been replaced by Q3View_Sync
  132.  */
  133. EXTERN_API_C( TQ3Status )
  134. Q3Renderer_Sync                    (TQ3RendererObject         renderer,
  135.                                  TQ3ViewObject             view);
  136.  
  137.  
  138.  
  139. /*
  140.  *    Q3Renderer_IsInteractive
  141.  *        Determine if this renderer is intended to be used interactively.
  142.  */
  143. EXTERN_API_C( TQ3Boolean )
  144. Q3Renderer_IsInteractive        (TQ3RendererObject         renderer);
  145.  
  146.  
  147. /*
  148.  *    Q3Renderer_HasModalConfigure
  149.  *        Determine if this renderer has a modal settings dialog.
  150.  *
  151.  *    Q3Renderer_ModalConfigure
  152.  *        Have the renderer pop up a modal dialog box to configure its settings.
  153.  *    dialogAnchor - is platform specific data passed by the client to support
  154.  *      movable modal dialogs. 
  155.  *    MacOS: this is a callback to the calling application's event handler.
  156.  *      The renderer calls this function with events not handled by the 
  157.  *      settings dialog. This is necessary in order to support movable modal 
  158.  *      dialogs. An application's event handler must return kQ3True if it 
  159.  *      handles the event passed to the callback or kQ3False if not. 
  160.  *      An application which doesn't want to support a movable modal configure
  161.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  162.  *    Win32: this is the HWND of the owning window (typically an application's
  163.  *      main window).
  164.  *  canceled - returns a boolean inditacating that the user canceled the 
  165.  *    dialog.
  166.  *      
  167.  */
  168. EXTERN_API_C( TQ3Boolean )
  169. Q3Renderer_HasModalConfigure    (TQ3RendererObject         renderer);
  170.  
  171. EXTERN_API_C( TQ3Status )
  172. Q3Renderer_ModalConfigure        (TQ3RendererObject         renderer,
  173.                                  TQ3DialogAnchor         dialogAnchor,
  174.                                  TQ3Boolean *            canceled);
  175.  
  176. /*
  177.  *    Q3RendererClass_GetNickNameString
  178.  *        Allows an application to get a renderers name string, the 
  179.  *        renderer is responsible for storing this in a localizable format
  180.  *        for example as a resource.  This string can then be used to provide
  181.  *        a selection mechanism for an application (for example in a menu).
  182.  *
  183.  *        If this call returns nil in the supplied string, then the App may 
  184.  *         choose to use the class name for the renderer.  You should always 
  185.  *        try to get the name string before using the class name, since the
  186.  *        class name is not localizable.
  187.  */
  188. EXTERN_API_C( TQ3Status )
  189. Q3RendererClass_GetNickNameString (TQ3ObjectType         rendererClassType,
  190.                                  TQ3ObjectClassNameString  rendererClassString);
  191.  
  192.  
  193. /*
  194.  *    Q3Renderer_GetConfigurationData
  195.  *        Allows an application to collect private renderer configuration data
  196.  *      which it will then save. For example in a preference file or in a 
  197.  *        style template. An application should tag this data with the 
  198.  *        Renderer's object  name.
  199.  *    
  200.  *        if dataBuffer is NULL actualDataSize returns the required size in 
  201.  *        bytes of a data buffer large enough to store private data. 
  202.  *
  203.  *      bufferSize is the actual size of the memory block pointed to by 
  204.  *        dataBuffer
  205.  *
  206.  *        actualDataSize - on return the actual number of bytes written to the 
  207.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  208.  * 
  209.  */
  210. EXTERN_API_C( TQ3Status )
  211. Q3Renderer_GetConfigurationData    (TQ3RendererObject         renderer,
  212.                                  unsigned char *        dataBuffer,
  213.                                  unsigned long             bufferSize,
  214.                                  unsigned long *        actualDataSize);
  215.  
  216. EXTERN_API_C( TQ3Status )
  217. Q3Renderer_SetConfigurationData    (TQ3RendererObject         renderer,
  218.                                  unsigned char *        dataBuffer,
  219.                                  unsigned long             bufferSize);
  220.  
  221.  
  222.  
  223. /******************************************************************************
  224.  **                                                                             **
  225.  **                        Interactive Renderer Specific Functions                 **
  226.  **                                                                             **
  227.  *****************************************************************************/
  228. /* CSG IDs attribute */
  229. #define kQ3AttributeType_ConstructiveSolidGeometryID        Q3_OBJECT_TYPE('c','s','g','i')
  230. /* Object IDs, to be applied as attributes on geometries */
  231. #define kQ3SolidGeometryObjNone (-1)
  232. #define kQ3SolidGeometryObjA     0
  233. #define kQ3SolidGeometryObjB     1
  234. #define kQ3SolidGeometryObjC     2
  235. #define kQ3SolidGeometryObjD     3
  236. #define kQ3SolidGeometryObjE     4
  237. /* Possible CSG equations */
  238.  
  239. enum {
  240.     kQ3CSGEquationAandB            = (long)0x88888888,
  241.     kQ3CSGEquationAandnotB        = 0x22222222,
  242.     kQ3CSGEquationAanBonCad        = 0x2F222F22,
  243.     kQ3CSGEquationnotAandB        = 0x44444444,
  244.     kQ3CSGEquationnAaBorCanB    = 0x74747474
  245. };
  246.  
  247.  
  248. typedef unsigned long                     TQ3CSGEquation;
  249.  
  250. enum {
  251.     kQ3HiddenSurfaceRemovalMode_None = 0,
  252.     kQ3HiddenSurfaceRemovalMode_Shallow = 1,
  253.     kQ3HiddenSurfaceRemovalMode_Deep = 2
  254. };
  255.  
  256. typedef unsigned long                     TQ3HiddenSurfaceRemovalMode;
  257. EXTERN_API_C( TQ3Status )
  258. Q3InteractiveRenderer_SetCSGEquation (TQ3RendererObject  renderer,
  259.                                  TQ3CSGEquation         equation);
  260.  
  261. EXTERN_API_C( TQ3Status )
  262. Q3InteractiveRenderer_GetCSGEquation (TQ3RendererObject  renderer,
  263.                                  TQ3CSGEquation *        equation);
  264.  
  265. EXTERN_API_C( TQ3Status )
  266. Q3InteractiveRenderer_SetPreferences (TQ3RendererObject  renderer,
  267.                                  long                     vendorID,
  268.                                  long                     engineID);
  269.  
  270. EXTERN_API_C( TQ3Status )
  271. Q3InteractiveRenderer_GetPreferences (TQ3RendererObject  renderer,
  272.                                  long *                    vendorID,
  273.                                  long *                    engineID);
  274.  
  275. EXTERN_API_C( TQ3Status )
  276. Q3InteractiveRenderer_SetDoubleBufferBypass (TQ3RendererObject  renderer,
  277.                                  TQ3Boolean             bypass);
  278.  
  279. EXTERN_API_C( TQ3Status )
  280. Q3InteractiveRenderer_GetDoubleBufferBypass (TQ3RendererObject  renderer,
  281.                                  TQ3Boolean *            bypass);
  282.  
  283. EXTERN_API_C( TQ3Status )
  284. Q3InteractiveRenderer_SetRAVEContextHints (TQ3RendererObject  renderer,
  285.                                  unsigned long             RAVEContextHints);
  286.  
  287. EXTERN_API_C( TQ3Status )
  288. Q3InteractiveRenderer_GetRAVEContextHints (TQ3RendererObject  renderer,
  289.                                  unsigned long *        RAVEContextHints);
  290.  
  291. EXTERN_API_C( TQ3Status )
  292. Q3InteractiveRenderer_SetRAVETextureFilter (TQ3RendererObject  renderer,
  293.                                  unsigned long             RAVEtextureFilterValue);
  294.  
  295. EXTERN_API_C( TQ3Status )
  296. Q3InteractiveRenderer_GetRAVETextureFilter (TQ3RendererObject  renderer,
  297.                                  unsigned long *        RAVEtextureFilterValue);
  298.  
  299.  
  300. /******************************************************************************
  301.  **                                                                             **
  302.  **                            Renderer View Tools                                 **
  303.  **                                                                             **
  304.  **                    You may only call these methods from a plug-in             **
  305.  **                                                                             **
  306.  *****************************************************************************/
  307. /*
  308.  *    Call by a renderer to call the user "idle" method, with progress 
  309.  *    information.
  310.  *    
  311.  *    Pass in (view, 0, n) on first call
  312.  *    Pass in (view, 1..n-1, n) during rendering
  313.  *    Pass in (view, n, n) upon completion
  314.  *    
  315.  *    Note: The user must have supplied an idleProgress method with 
  316.  *    Q3XView_SetIdleProgressMethod. Otherwise, the generic idle method is
  317.  *    called with no progress data. e.g. the Q3View_SetIdleMethod method
  318.  *    is called instead. (current and final are ignored, essentially.)
  319.  *
  320.  *    Returns kQ3Failure if rendering is cancelled.
  321.  */
  322. EXTERN_API_C( TQ3Status )
  323. Q3XView_IdleProgress            (TQ3ViewObject             view,
  324.                                  unsigned long             current,
  325.                                  unsigned long             completed);
  326.  
  327. /*
  328.  *    Called by an asynchronous renderer when it completes a frame.
  329.  */
  330. EXTERN_API_C( TQ3Status )
  331. Q3XView_EndFrame                (TQ3ViewObject             view);
  332.  
  333.  
  334. /******************************************************************************
  335.  **                                                                             **
  336.  **                            Renderer AttributeSet Tools                         **
  337.  **                                                                             **
  338.  **                    You may only call these methods from a plug-in             **
  339.  **                                                                             **
  340.  *****************************************************************************/
  341. /*
  342.  *    Faster access to geometry attribute sets.
  343.  *    
  344.  *    Returns pointer to INTERNAL data structure for elements and attributes
  345.  *    in an attributeSet, or NULL if no attribute exists.
  346.  *    
  347.  *    For attributes of type kQ3AttributeType..., the internal data structure
  348.  *    is identical to the data structure used in Q3AttributeSet_Add.
  349.  */
  350. EXTERN_API_C( void *)
  351. Q3XAttributeSet_GetPointer        (TQ3AttributeSet         attributeSet,
  352.                                  TQ3AttributeType         attributeType);
  353.  
  354.  
  355.  
  356. enum {
  357.     kQ3XAttributeMaskNone        = 0,
  358.     kQ3XAttributeMaskSurfaceUV    = 1 << (kQ3AttributeTypeSurfaceUV - 1),
  359.     kQ3XAttributeMaskShadingUV    = 1 << (kQ3AttributeTypeShadingUV - 1),
  360.     kQ3XAttributeMaskNormal        = 1 << (kQ3AttributeTypeNormal - 1),
  361.     kQ3XAttributeMaskAmbientCoefficient = 1 << (kQ3AttributeTypeAmbientCoefficient - 1),
  362.     kQ3XAttributeMaskDiffuseColor = 1 << (kQ3AttributeTypeDiffuseColor - 1),
  363.     kQ3XAttributeMaskSpecularColor = 1 << (kQ3AttributeTypeSpecularColor - 1),
  364.     kQ3XAttributeMaskSpecularControl = 1 << (kQ3AttributeTypeSpecularControl - 1),
  365.     kQ3XAttributeMaskTransparencyColor = 1 << (kQ3AttributeTypeTransparencyColor - 1),
  366.     kQ3XAttributeMaskSurfaceTangent = 1 << (kQ3AttributeTypeSurfaceTangent - 1),
  367.     kQ3XAttributeMaskHighlightState = 1 << (kQ3AttributeTypeHighlightState - 1),
  368.     kQ3XAttributeMaskSurfaceShader = 1 << (kQ3AttributeTypeSurfaceShader - 1),
  369.     kQ3XAttributeMaskCustomAttribute = (long)0x80000000,
  370.     kQ3XAttributeMaskAll        = (long)0x800007FF,
  371.     kQ3XAttributeMaskInherited    = 0x03FF,
  372.     kQ3XAttributeMaskInterpolated = kQ3XAttributeMaskSurfaceUV | kQ3XAttributeMaskShadingUV | kQ3XAttributeMaskNormal | kQ3XAttributeMaskAmbientCoefficient | kQ3XAttributeMaskDiffuseColor | kQ3XAttributeMaskSpecularColor | kQ3XAttributeMaskSpecularControl | kQ3XAttributeMaskTransparencyColor | kQ3XAttributeMaskSurfaceTangent
  373. };
  374.  
  375. typedef unsigned long                     TQ3XAttributeMask;
  376. EXTERN_API_C( TQ3XAttributeMask )
  377. Q3XAttributeSet_GetMask            (TQ3AttributeSet         attributeSet);
  378.  
  379.  
  380. /******************************************************************************
  381.  **                                                                             **
  382.  **                            Renderer Draw Context Tools                         **
  383.  **                                                                             **
  384.  *****************************************************************************/
  385. typedef struct OpaqueTQ3XDrawRegion*     TQ3XDrawRegion;
  386. EXTERN_API_C( TQ3Status )
  387. Q3XDrawContext_GetDrawRegion    (TQ3DrawContextObject     drawContext,
  388.                                  TQ3XDrawRegion *        drawRegion);
  389.  
  390.  
  391. enum {
  392.     kQ3XDrawContextValidationClearFlags = 0x00000000,
  393.     kQ3XDrawContextValidationDoubleBuffer = 1 << 0,
  394.     kQ3XDrawContextValidationShader = 1 << 1,
  395.     kQ3XDrawContextValidationClearFunction = 1 << 2,
  396.     kQ3XDrawContextValidationActiveBuffer = 1 << 3,
  397.     kQ3XDrawContextValidationInternalOffScreen = 1 << 4,
  398.     kQ3XDrawContextValidationPane = 1 << 5,
  399.     kQ3XDrawContextValidationMask = 1 << 6,
  400.     kQ3XDrawContextValidationDevice = 1 << 7,
  401.     kQ3XDrawContextValidationWindow = 1 << 8,
  402.     kQ3XDrawContextValidationWindowSize = 1 << 9,
  403.     kQ3XDrawContextValidationWindowClip = 1 << 10,
  404.     kQ3XDrawContextValidationWindowPosition = 1 << 11,
  405.     kQ3XDrawContextValidationPlatformAttributes = 1 << 12,
  406.     kQ3XDrawContextValidationForegroundShader = 1 << 13,
  407.     kQ3XDrawContextValidationBackgroundShader = 1 << 14,
  408.     kQ3XDrawContextValidationColorPalette = 1 << 15,
  409.     kQ3XDrawContextValidationAll = (long)0xFFFFFFFF
  410. };
  411.  
  412. typedef unsigned long                     TQ3XDrawContextValidationMasks;
  413. typedef unsigned long                     TQ3XDrawContextValidation;
  414. EXTERN_API_C( TQ3Status )
  415. Q3XDrawContext_ClearValidationFlags (TQ3DrawContextObject  drawContext);
  416.  
  417. EXTERN_API_C( TQ3Status )
  418. Q3XDrawContext_GetValidationFlags (TQ3DrawContextObject  drawContext,
  419.                                  TQ3XDrawContextValidation * validationFlags);
  420.  
  421.  
  422. /******************************************************************************
  423.  **                                                                             **
  424.  **                            Renderer Draw Region Tools                         **
  425.  **                                                                             **
  426.  *****************************************************************************/
  427.  
  428. enum {
  429.                                                                 /* These do not indicate byte ordering   */
  430.     kQ3XDevicePixelTypeInvalid    = 0,                            /* Unknown, un-initialized type     */
  431.     kQ3XDevicePixelTypeRGB32    = 1,                            /* Alpha:8 (ignored), R:8, G:8, B:8 */
  432.     kQ3XDevicePixelTypeARGB32    = 2,                            /* Alpha:8, R:8, G:8, B:8              */
  433.     kQ3XDevicePixelTypeRGB24    = 3,                            /* 24 bits/pixel, R:8, G:8, B:8     */
  434.     kQ3XDevicePixelTypeRGB16    = 4,                            /* Alpha:1 (ignored), R:5, G:5, B:5 */
  435.     kQ3XDevicePixelTypeARGB16    = 5,                            /* Alpha:1, R:5, G:5, B:5              */
  436.     kQ3XDevicePixelTypeRGB16_565 = 6,                            /* 16 bits/pixel, R:5, G:6, B:5     */
  437.     kQ3XDevicePixelTypeIndexed8    = 7,                            /* 8-bit color table index             */
  438.     kQ3XDevicePixelTypeIndexed4    = 8,                            /* 4-bit color table index             */
  439.     kQ3XDevicePixelTypeIndexed2    = 9,                            /* 2-bit color table index             */
  440.     kQ3XDevicePixelTypeIndexed1    = 10                            /* 1-bit color table index             */
  441. };
  442.  
  443. typedef unsigned long                     TQ3XDevicePixelType;
  444.  
  445. enum {
  446.     kQ3XClipMaskFullyExposed    = 0,
  447.     kQ3XClipMaskPartiallyExposed = 1,
  448.     kQ3XClipMaskNotExposed        = 2
  449. };
  450.  
  451. typedef unsigned long                     TQ3XClipMaskState;
  452.  
  453. struct TQ3XColorDescriptor {
  454.     unsigned long                     redShift;
  455.     unsigned long                     redMask;
  456.     unsigned long                     greenShift;
  457.     unsigned long                     greenMask;
  458.     unsigned long                     blueShift;
  459.     unsigned long                     blueMask;
  460.     unsigned long                     alphaShift;
  461.     unsigned long                     alphaMask;
  462. };
  463. typedef struct TQ3XColorDescriptor        TQ3XColorDescriptor;
  464.  
  465. struct TQ3XDrawRegionDescriptor {
  466.     unsigned long                     width;
  467.     unsigned long                     height;
  468.     unsigned long                     rowBytes;
  469.     unsigned long                     pixelSize;
  470.     TQ3XDevicePixelType             pixelType;
  471.     TQ3XColorDescriptor             colorDescriptor;
  472.     TQ3Endian                         bitOrder;
  473.     TQ3Endian                         byteOrder;
  474.     TQ3Bitmap *                        clipMask;
  475. };
  476. typedef struct TQ3XDrawRegionDescriptor    TQ3XDrawRegionDescriptor;
  477.  
  478. enum {
  479.     kQ3XDrawRegionServicesNoneFlag = 0L,
  480.     kQ3XDrawRegionServicesClearFlag = 1 << 0,
  481.     kQ3XDrawRegionServicesDontLockDDSurfaceFlag = 1 << 1
  482. };
  483.  
  484.  
  485. typedef unsigned long                     TQ3XDrawRegionServicesMasks;
  486. typedef unsigned long                     TQ3XDrawRegionServices;
  487. typedef CALLBACK_API_C( void , TQ3XDrawRegionRendererPrivateDeleteMethod )(void *rendererPrivate);
  488. EXTERN_API_C( TQ3Status )
  489. Q3XDrawRegion_GetDeviceScaleX    (TQ3XDrawRegion         drawRegion,
  490.                                  float *                deviceScaleX);
  491.  
  492. EXTERN_API_C( TQ3Status )
  493. Q3XDrawRegion_GetDeviceScaleY    (TQ3XDrawRegion         drawRegion,
  494.                                  float *                deviceScaleY);
  495.  
  496.  
  497. EXTERN_API_C( TQ3Status )
  498. Q3XDrawRegion_GetDeviceOffsetX    (TQ3XDrawRegion         drawRegion,
  499.                                  float *                deviceOffsetX);
  500.  
  501. EXTERN_API_C( TQ3Status )
  502. Q3XDrawRegion_GetDeviceOffsetY    (TQ3XDrawRegion         drawRegion,
  503.                                  float *                deviceOffsetX);
  504.  
  505.  
  506. EXTERN_API_C( TQ3Status )
  507. Q3XDrawRegion_GetWindowScaleX    (TQ3XDrawRegion         drawRegion,
  508.                                  float *                windowScaleX);
  509.  
  510. EXTERN_API_C( TQ3Status )
  511. Q3XDrawRegion_GetWindowScaleY    (TQ3XDrawRegion         drawRegion,
  512.                                  float *                windowScaleY);
  513.  
  514.  
  515. EXTERN_API_C( TQ3Status )
  516. Q3XDrawRegion_GetWindowOffsetX    (TQ3XDrawRegion         drawRegion,
  517.                                  float *                windowOffsetX);
  518.  
  519. EXTERN_API_C( TQ3Status )
  520. Q3XDrawRegion_GetWindowOffsetY    (TQ3XDrawRegion         drawRegion,
  521.                                  float *                windowOffsetY);
  522.  
  523. EXTERN_API_C( TQ3Status )
  524. Q3XDrawRegion_IsActive            (TQ3XDrawRegion         drawRegion,
  525.                                  TQ3Boolean *            isActive);
  526.  
  527.  
  528. EXTERN_API_C( TQ3Status )
  529. Q3XDrawRegion_GetNextRegion        (TQ3XDrawRegion         drawRegion,
  530.                                  TQ3XDrawRegion *        nextDrawRegion);
  531.  
  532. /* 
  533.  *  One of the next two functions must be called before using a draw region 
  534.  */
  535. /*
  536.  *    Use this Start function if double buffering/image access services from the
  537.  *    Draw Context are not needed, you may still request clear for example
  538.  */
  539. EXTERN_API_C( TQ3Status )
  540. Q3XDrawRegion_Start                (TQ3XDrawRegion         drawRegion,
  541.                                  TQ3XDrawRegionServices  services,
  542.                                  TQ3XDrawRegionDescriptor ** descriptor);
  543.  
  544. /*
  545.  *    Use this Start function if double buffering or image access services from 
  546.  *  the Draw Context are needed.
  547.  */
  548. EXTERN_API_C( TQ3Status )
  549. Q3XDrawRegion_StartAccessToImageBuffer (TQ3XDrawRegion     drawRegion,
  550.                                  TQ3XDrawRegionServices  services,
  551.                                  TQ3XDrawRegionDescriptor ** descriptor,
  552.                                  void **                image);
  553.  
  554. /*
  555.  *    This function is used to indicate that access to a DrawRegion is ended.
  556.  */
  557. EXTERN_API_C( TQ3Status )
  558. Q3XDrawRegion_End                (TQ3XDrawRegion         drawRegion);
  559.  
  560. EXTERN_API_C( TQ3Status )
  561. Q3XDrawRegion_GetDeviceTransform (TQ3XDrawRegion         drawRegion,
  562.                                  TQ3Matrix4x4 **        deviceTransform);
  563.  
  564. EXTERN_API_C( TQ3Status )
  565. Q3XDrawRegion_GetClipFlags        (TQ3XDrawRegion         drawRegion,
  566.                                  TQ3XClipMaskState *    clipMaskState);
  567.  
  568. EXTERN_API_C( TQ3Status )
  569. Q3XDrawRegion_GetClipMask        (TQ3XDrawRegion         drawRegion,
  570.                                  TQ3Bitmap **            clipMask);
  571.  
  572. #if TARGET_OS_MAC
  573. EXTERN_API_C( TQ3Status )
  574. Q3XDrawRegion_GetClipRegion        (TQ3XDrawRegion         drawRegion,
  575.                                  RgnHandle *            rgnHandle);
  576.  
  577. EXTERN_API_C( TQ3Status )
  578. Q3XDrawRegion_GetGDHandle        (TQ3XDrawRegion         drawRegion,
  579.                                  GDHandle *                gdHandle);
  580.  
  581. #endif  /* TARGET_OS_MAC */
  582.  
  583. EXTERN_API_C( TQ3Status )
  584. Q3XDrawRegion_GetRendererPrivate (TQ3XDrawRegion         drawRegion,
  585.                                  void **                rendererPrivate);
  586.  
  587. EXTERN_API_C( TQ3Status )
  588. Q3XDrawRegion_SetRendererPrivate (TQ3XDrawRegion         drawRegion,
  589.                                  const void *            rendererPrivate,
  590.                                  TQ3XDrawRegionRendererPrivateDeleteMethod  deleteMethod);
  591.  
  592. EXTERN_API_C( TQ3Status )
  593. Q3XDrawRegion_SetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  594.                                  TQ3Boolean             flag);
  595.  
  596. EXTERN_API_C( TQ3Status )
  597. Q3XDrawRegion_GetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  598.                                  TQ3Boolean *            useDefaultRenderingFlag);
  599.  
  600.  
  601.  
  602. /******************************************************************************
  603.  **                                                                             **
  604.  **                            Renderer Class Methods                             **
  605.  **                                                                             **
  606.  *****************************************************************************/
  607. /*
  608.  *    Methods from Object
  609.  *        kQ3XMethodTypeObjectClassRegister
  610.  *        kQ3XMethodTypeObjectClassUnregister
  611.  *        kQ3XMethodTypeObjectNew
  612.  *        kQ3XMethodTypeObjectDelete
  613.  *        kQ3XMethodTypeObjectRead
  614.  *        kQ3XMethodTypeObjectTraverse
  615.  *        kQ3XMethodTypeObjectWrite
  616.  *        
  617.  *    Methods from Shared
  618.  *        kQ3MethodTypeSharedEdited
  619.  *
  620.  *    Renderer Methods
  621.  *    
  622.  *    The renderer methods should be implemented according to the type
  623.  *    of renderer being written.
  624.  *
  625.  *    For the purposes of documentation, there are two basic types of
  626.  *    renderers: 
  627.  *
  628.  *        Interactive
  629.  *            Interactive Renderer
  630.  *            WireFrame Renderer
  631.  *        
  632.  *        Deferred
  633.  *            a ray-tracer
  634.  *            painter's algorithm renderer (cached in a BSP triangle tree)
  635.  *            an artistic renderer (simulates a pencil drawing, etc.)
  636.  *
  637.  *    The main difference is how each renderer handles incoming state and 
  638.  *    geometry.
  639.  *
  640.  *    An interactive renderer immediately transforms, culls, and shades
  641.  *    incoming geometry and performs rasterization. For example, in a 
  642.  *    single-buffered WireFrame renderer, you will see a new triangle
  643.  *    immediately after Q3Triangle_Draw (if it's visible, of course).
  644.  *
  645.  *    A deferred renderer caches the view state and each geometry, 
  646.  *    converting into any internal queue of drawing commands. Rasterization
  647.  *    is not actually performed until all data has been submitted.
  648.  *    
  649.  *    For example, a ray-tracer may not rasterize anything until the
  650.  *    end of the rendering loop, or until an EndFrame call is made.
  651.  */
  652.  
  653. /******************************************************************************
  654.  **                                                                             **
  655.  **                        Renderer User Interface Methods                         **
  656.  **                                                                             **
  657.  *****************************************************************************/
  658. /*
  659.  *    kQ3XMethodTypeRendererIsInteractive
  660.  *    
  661.  *    There is no actual method with this - the metahandler simply returns
  662.  *  "(TQ3XFunctionPointer)kQ3True" for this "method" if the renderer is 
  663.  *  intended to be used in interactive settings, and   
  664.  *    "(TQ3XFunctionPointer)kQ3False" otherwise. 
  665.  *  
  666.  *  If neither value is specified in the metahandler, the renderer 
  667.  *  is *assumed to be non-interactive*!!!
  668.  *    
  669.  *    OPTIONAL
  670.  */
  671.  
  672. enum {
  673.     kQ3XMethodTypeRendererIsInteractive = FOUR_CHAR_CODE('isin')
  674. };
  675.  
  676.  
  677. /*
  678.  *    TQ3XRendererModalConfigureMethod
  679.  *    
  680.  *    This method should pop up a modal dialog to edit the renderer settings 
  681.  *    found in the renderer private. 
  682.  *    
  683.  *    dialogAnchor - is platform specific data passed by the client to support
  684.  *      movable modal dialogs. 
  685.  *    MacOS: this is a callback to the calling application's event handler.
  686.  *      The renderer calls this function with events not handled by the 
  687.  *      settings dialog. This is necessary in order to support movable modal 
  688.  *      dialogs. An application's event handler must return kQ3True if it 
  689.  *      handles the event passed to the callback or kQ3False if not. 
  690.  *      An application which doesn't want to support a movable modal configure
  691.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  692.  *      A renderer should implement a non-movable style dialog in that case.
  693.  *    Win32: this is the HWND of the owning window (typically an application's
  694.  *      main window).  (Win32 application modal dialogs are always movable.)
  695.  *  canceled - returns a boolean inditacating that the user canceled the 
  696.  *    dialog.
  697.  *    
  698.  *    OPTIONAL
  699.  */
  700.  
  701. enum {
  702.     kQ3XMethodTypeRendererModalConfigure = FOUR_CHAR_CODE('rdmc')
  703. };
  704.  
  705. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererModalConfigureMethod )(TQ3RendererObject renderer, TQ3DialogAnchor dialogAnchor, TQ3Boolean *canceled, void *rendererPrivate);
  706. /*
  707.  *    kQ3XMethodTypeRendererGetNickNameString
  708.  *    
  709.  *        Allows an application to collect the name of the renderer for
  710.  *        display in a user interface item such as a menu.
  711.  *    
  712.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  713.  *        bytes of a data buffer large enough to store the renderer name. 
  714.  *
  715.  *      bufferSize is the actual size of the memory block pointed to by 
  716.  *        dataBuffer
  717.  *
  718.  *        actualDataSize - on return the actual number of bytes written to the
  719.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  720.  *
  721.  *    OPTIONAL
  722.  */
  723.  
  724. enum {
  725.     kQ3XMethodTypeRendererGetNickNameString = FOUR_CHAR_CODE('rdns')
  726. };
  727.  
  728. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetNickNameStringMethod )(unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize);
  729. /*
  730.  *    kQ3XMethodTypeRendererGetConfigurationData
  731.  *    
  732.  *        Allows an application to collect private configuration data from the
  733.  *      renderer which it will then save. For example in a preference file, 
  734.  *      a registry key (on Windows) or in a style template. An application 
  735.  *      should tag this data with the renderer's object name.
  736.  *    
  737.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  738.  *        bytes of a data buffer large enough to store private data. 
  739.  *
  740.  *      bufferSize is the actual size of the memory block pointed to by 
  741.  *        dataBuffer
  742.  *
  743.  *        actualDataSize - on return the actual number of bytes written to the
  744.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  745.  *
  746.  *    OPTIONAL
  747.  */
  748.  
  749. enum {
  750.     kQ3XMethodTypeRendererGetConfigurationData = FOUR_CHAR_CODE('rdgp')
  751. };
  752.  
  753. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize, void *rendererPrivate);
  754. /*
  755.  *    TQ3XRendererSetConfigurationDataMethod
  756.  *    
  757.  *        Allows an application to pass private configuration data which has
  758.  *         previously  been obtained from a renderer via 
  759.  *        Q3Renderer_GetConfigurationData. For example in a preference file or 
  760.  *        in a style template. An application should tag this data with the 
  761.  *        renderer's object name.
  762.  *    
  763.  *      bufferSize is the actual size of the memory block pointed to by 
  764.  *        dataBuffer
  765.  *
  766.  *    OPTIONAL
  767.  */
  768.  
  769. enum {
  770.     kQ3XMethodTypeRendererSetConfigurationData = FOUR_CHAR_CODE('rdsp')
  771. };
  772.  
  773. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, void *rendererPrivate);
  774. /******************************************************************************
  775.  **                                                                             **
  776.  **                        Renderer Drawing State Methods                         **
  777.  **                                                                             **
  778.  *****************************************************************************/
  779. /*
  780.  *    TQ3RendererStartFrame
  781.  *    
  782.  *    The StartFrame method is called first at Q3View_StartRendering
  783.  *    and should:
  784.  *        - initialize any renderer state to defaults
  785.  *        - extract any and all useful data from the drawContext
  786.  *
  787.  *    If your renderer passed in kQ3RendererFlagClearBuffer at 
  788.  *    registration, then it should also:
  789.  *        - clear the drawContext 
  790.  *    
  791.  *        When clearing, your renderer may opt to:
  792.  *        - NOT clear anything (if you touch every pixel, for example)
  793.  *        - to clear with your own routine, or
  794.  *        - to use the draw context default clear method by calling 
  795.  *        Q3DrawContext_Clear. Q3DrawContext_Clear takes advantage of
  796.  *        any available hardware in the system for clearing.
  797.  *    
  798.  *    This call also signals the start of all default submit commands from
  799.  *    the view. The renderer will receive updates for the default view
  800.  *    state via its Update methods before StartPass is called.
  801.  *    
  802.  *    REQUIRED
  803.  */
  804.  
  805. enum {
  806.     kQ3XMethodTypeRendererStartFrame = FOUR_CHAR_CODE('rdcl')
  807. };
  808.  
  809. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  810. /*
  811.  *    kQ3XMethodTypeRendererStartPass
  812.  *    TQ3XRendererStartPassMethod
  813.  *    
  814.  *    The StartPass method is called during Q3View_StartRendering but after
  815.  *    the StartFrame command. It should:
  816.  *        - collect camera and light information
  817.  *    
  818.  *    If your renderer supports deferred camera transformation, camera is the
  819.  *    main camera which will be submitted in the hierarchy somewhere. It
  820.  *    is never NULL.
  821.  *
  822.  *    If your renderer does not support deferred camera transformation, camera
  823.  *    is the transformed camera.
  824.  *
  825.  *    If your renderer supports deferred light transformation, lights will be
  826.  *    NULL, and will be submitted to your light draw methods instead.
  827.  *
  828.  *    This call signals the end of the default update state, and the start of 
  829.  *  submit commands from the user to the view.
  830.  *
  831.  *    REQUIRED
  832.  */
  833.  
  834. enum {
  835.     kQ3XMethodTypeRendererStartPass = FOUR_CHAR_CODE('rdst')
  836. };
  837.  
  838. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartPassMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, TQ3GroupObject lightGroup);
  839. /*
  840.  *    kQ3XMethodTypeRendererFlushFrame
  841.  *    TQ3XRendererFlushFrameMethod
  842.  *    
  843.  *    This call is only implemented by asynchronous renderers.
  844.  *    
  845.  *    The FlushFrame method is called between the StartPass and EndPass
  846.  *    methods and is called when the user wishes to flush any asynchronous
  847.  *    drawing tasks (which draw to the drawcontext), but does not want 
  848.  *    to block.
  849.  *    
  850.  *    The result of this call is that an image should "eventually" appear
  851.  *    asynchronously.
  852.  *    
  853.  *    For asynchronous rendering, this call is non-blocking.
  854.  *    
  855.  *    An interactive renderer should ensure that all received
  856.  *    geometries are drawn in the image.
  857.  *    
  858.  *    An interactive renderer that talks to hardware should force
  859.  *    the hardware to generate an image.
  860.  *    
  861.  *    A deferred renderer should exhibit a similar behaviour,
  862.  *    though it is not required.  A deferred renderer should spawn
  863.  *    a process that generates a partial image from the currently
  864.  *    accumulated drawing state. 
  865.  *    
  866.  *    However, for renderers such as ray-tracers which generally are
  867.  *    quite compute-intensive, FlushFrame is not required and is a no-op.
  868.  *
  869.  *    OPTIONAL
  870.  */
  871.  
  872. enum {
  873.     kQ3XMethodTypeRendererFlushFrame = FOUR_CHAR_CODE('rdfl')
  874. };
  875.  
  876. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererFlushFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  877. /*
  878.  *    kQ3XMethodTypeRendererEndPass
  879.  *    TQ3XRendererEndPassMethod
  880.  *    
  881.  *    The EndPass method is called at Q3View_EndRendering and signals
  882.  *    the end of submit commands to the view.
  883.  *
  884.  *    If an error occurs, the renderer should call Q3XError_Post and
  885.  *    return kQ3ViewStatusError.
  886.  *    
  887.  *    If a renderer requires another pass on the renderering data,
  888.  *    it should return kQ3ViewStatusRetraverse.
  889.  *    
  890.  *    If rendering was cancelled, this function will not be called
  891.  *    and the view will handle returning kQ3ViewStatusCancelled;
  892.  *    
  893.  *    Otherwise, your renderer should begin completing the process of 
  894.  *    generating the image in the drawcontext. If you have buffered
  895.  *    any drawing data, flush it. RendererEnd should have a similar
  896.  *    effect as RendererFlushFrame.
  897.  *    
  898.  *    If the renderer is synchronous:
  899.  *        - complete rendering of the entire frame
  900.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer
  901.  *            - Update the front buffer
  902.  *        else
  903.  *            - DrawContext will update the front buffer after returning
  904.  *
  905.  *    If the renderer is asynchronous
  906.  *        - spawn rendering thread for entire frame
  907.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer,
  908.  *            - you must eventually update the front buffer asynchronously
  909.  *        else
  910.  *            - you must eventually update the back buffer asynchronously
  911.  *            
  912.  *    REQUIRED
  913.  */
  914.  
  915. enum {
  916.     kQ3XMethodTypeRendererEndPass = FOUR_CHAR_CODE('rded')
  917. };
  918.  
  919. typedef CALLBACK_API_C( TQ3ViewStatus , TQ3XRendererEndPassMethod )(TQ3ViewObject view, void *rendererPrivate);
  920. /*
  921.  *    kQ3XMethodTypeRendererEndFrame
  922.  *    TQ3XRendererEndFrame
  923.  *    
  924.  *    This call is only implemented by asynchronous renderers.
  925.  *
  926.  *    The EndFrame method is called from Q3View_Sync, which is
  927.  *    called after Q3View_EndRendering and signals that the user
  928.  *    wishes to see the completed image and is willing to block.
  929.  *    
  930.  *    If your renderer supports kQ3RendererFlagDoubleBuffer
  931.  *        - update the front buffer completely 
  932.  *    else
  933.  *        - update the back buffer completely
  934.  *
  935.  *    This call is equivalent in functionality to RendererFlushFrame
  936.  *    but blocks until the image is completed.
  937.  *    
  938.  *    If no method is supplied, the default is a no-op.
  939.  *    
  940.  *    NOTE: Registering a method of this type indicates that your renderer will
  941.  *    be rendering after Q3View_EndRendering has been called.
  942.  *    
  943.  *    OPTIONAL
  944.  */
  945.  
  946. enum {
  947.     kQ3XMethodTypeRendererEndFrame = FOUR_CHAR_CODE('rdsy')
  948. };
  949.  
  950. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererEndFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  951. /*
  952.  *    The RendererCancel method is called after Q3View_StartRendering
  953.  *    and signals the termination of all rendering operations.
  954.  *
  955.  *    A renderer should clean up any cached data, and cancel all 
  956.  *    rendering operations.
  957.  *    
  958.  *    If called before Q3View_EndRendering, the RendererEnd method
  959.  *    is NOT called.
  960.  *    
  961.  *    If called after Q3View_EndRendering, the renderer should kill
  962.  *    any threads and terminate any further rendering.
  963.  *    
  964.  *    REQUIRED
  965.  */
  966.  
  967. enum {
  968.     kQ3XMethodTypeRendererCancel = FOUR_CHAR_CODE('rdab')
  969. };
  970.  
  971. typedef CALLBACK_API_C( void , TQ3XRendererCancelMethod )(TQ3ViewObject view, void *rendererPrivate);
  972. /******************************************************************************
  973.  **                                                                             **
  974.  **                        Renderer DrawContext Methods                         **
  975.  **                                                                             **
  976.  *****************************************************************************/
  977. /*
  978.  *    kQ3XMethodTypeRendererPush
  979.  *    TQ3XRendererPushMethod
  980.  *    
  981.  *    kQ3XMethodTypeRendererPop
  982.  *    TQ3XRendererPopMethod
  983.  *    
  984.  *    These methods are called whenever the graphics state in the view
  985.  *    is pushed or popped. The user may isolate state by calling:
  986.  *    
  987.  *    Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &red, view);
  988.  *    Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &blue, view);
  989.  *    Q3Attribute_Submit(kQ3AttributeTypeSpecularColor, &white, view);
  990.  *    Q3Box_Submit(&unitBox, view);
  991.  *    Q3TranslateTransform_Submit(&unitVector, view);
  992.  *    Q3Push_Submit(view);
  993.  *        Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &blue, view);
  994.  *        Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &green, view);
  995.  *        Q3Box_Submit(&unitBox, view);
  996.  *    Q3Pop_Submit(view);    
  997.  *    Q3TranslateTransform_Submit(&unitVector, view);
  998.  *    Q3Box_Submit(&unitBox, view);
  999.  *    
  1000.  *    or by submitting a display group which pushes and pops.
  1001.  *    
  1002.  *    If you support RendererPush and RendererPop in your renderer:
  1003.  *        - you must maintain your drawing state as a stack, as well.
  1004.  *        - you will not be updated with the popped state after
  1005.  *            RendererPop is called.
  1006.  *
  1007.  *    If you do not support Push and Pop in your renderer:
  1008.  *        - you may maintain a single copy of the drawing state.
  1009.  *        - you will be updated with changed fields after the view stack is
  1010.  *            popped.
  1011.  *
  1012.  *    A renderer that supports Push and Pop gets called in the following
  1013.  *    sequence (from example above):
  1014.  *    
  1015.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1016.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1017.  *    RendererUpdateAttributeSpecularColor(&white,...)
  1018.  *    RendererUpdateMatrixLocalToWorld(...)
  1019.  *    RendererSubmitGeometryBox(...)
  1020.  *    RendererPush(...)
  1021.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  1022.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  1023.  *        RendererSubmitGeometryBox(...)
  1024.  *    RendererPop(...)
  1025.  *    RendererUpdateMatrixLocalToWorld(...)
  1026.  *    RendererSubmitGeometryBox(...)
  1027.  *
  1028.  *    A renderer that does not supports Push and Pop gets called in the
  1029.  *    following sequence:
  1030.  *    
  1031.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1032.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1033.  *    RendererUpdateAttributeSpecularColor(&white,...)
  1034.  *    RendererUpdateMatrixLocalToWorld(...)
  1035.  *    RendererSubmitGeometryBox(...)
  1036.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  1037.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  1038.  *        RendererSubmitGeometryBox(...)
  1039.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1040.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1041.  *    RendererUpdateMatrixLocalToWorld(...)
  1042.  *    RendererSubmitGeometryBox(...)
  1043.  *    
  1044.  */
  1045.  
  1046. enum {
  1047.     kQ3XMethodTypeRendererPush    = FOUR_CHAR_CODE('rdps')
  1048. };
  1049.  
  1050. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPushMethod )(TQ3ViewObject view, void *rendererPrivate);
  1051.  
  1052. enum {
  1053.     kQ3XMethodTypeRendererPop    = FOUR_CHAR_CODE('rdpo')
  1054. };
  1055.  
  1056. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPopMethod )(TQ3ViewObject view, void *rendererPrivate);
  1057. /******************************************************************************
  1058.  **                                                                             **
  1059.  **                            Renderer Cull Methods                             **
  1060.  **                                                                             **
  1061.  *****************************************************************************/
  1062. /*
  1063.  *    kQ3XMethodTypeRendererIsBoundingBoxVisible
  1064.  *    TQ3XRendererIsBoundingBoxVisibleMethod
  1065.  *    
  1066.  *    This method is called to cull complex groups and geometries 
  1067.  *    given their bounding box in local space.
  1068.  *    
  1069.  *    It should transform the local-space bounding box coordinates to
  1070.  *    frustum space and return a TQ3Boolean return value indicating
  1071.  *    whether the box appears within the viewing frustum.
  1072.  *    
  1073.  *    If no method is supplied, the default behavior is to return
  1074.  *    kQ3True.
  1075.  *    
  1076.  */
  1077.  
  1078. enum {
  1079.     kQ3XMethodTypeRendererIsBoundingBoxVisible = FOUR_CHAR_CODE('rdbx')
  1080. };
  1081.  
  1082. typedef CALLBACK_API_C( TQ3Boolean , TQ3XRendererIsBoundingBoxVisibleMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3BoundingBox *bBox);
  1083.  
  1084. /******************************************************************************
  1085.  **                                                                             **
  1086.  **                        Renderer Object Support Methods                         **
  1087.  **                                                                             **
  1088.  *****************************************************************************/
  1089. /*
  1090.  *    Drawing methods (Geometry, Camera, Lights)
  1091.  *
  1092.  */
  1093. /*
  1094.  *    Geometry MetaHandler
  1095.  *    
  1096.  *    This metaHandler is required to support 
  1097.  *    
  1098.  *    kQ3GeometryTypeTriangle
  1099.  *    kQ3GeometryTypeLine
  1100.  *    kQ3GeometryTypePoint
  1101.  *    kQ3GeometryTypeMarker
  1102.  *    kQ3GeometryTypePixmapMarker
  1103.  *    
  1104.  *    REQUIRED
  1105.  */
  1106.  
  1107. enum {
  1108.     kQ3XMethodTypeRendererSubmitGeometryMetaHandler = FOUR_CHAR_CODE('rdgm')
  1109. };
  1110.  
  1111. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitGeometryMetaHandlerMethod )(TQ3ObjectType geometryType);
  1112. /*
  1113.  *    The TQ3XRendererSubmitGeometryMetaHandlerMethod switches on geometryType
  1114.  *    of kQ3GeometryTypeFoo and returns methods of type:
  1115.  */
  1116. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitGeometryMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3GeometryObject geometry, const void *publicData);
  1117. /*
  1118.  *    Camera MetaHandler
  1119.  *    
  1120.  *    This metaHandler, if supplied, indicates that your renderer
  1121.  *    handles deferred transformation of the main camera within a scene.
  1122.  *    
  1123.  *    If not supplied, or an unsupported camera is used, the view will do
  1124.  *    the transformation for the renderer and pass in a camera in the 
  1125.  *    StartPass method.
  1126.  *    
  1127.  *    OPTIONAL
  1128.  */
  1129.  
  1130. enum {
  1131.     kQ3XMethodTypeRendererSubmitCameraMetaHandler = FOUR_CHAR_CODE('rdcm')
  1132. };
  1133.  
  1134. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitCameraMetaHandlerMethod )(TQ3ObjectType cameraType);
  1135. /*
  1136.  *    The TQ3XRendererSubmitCameraMetaHandlerMethod switches on cameraType
  1137.  *    of kQ3CameraTypeFoo and returns methods of type:
  1138.  */
  1139. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitCameraMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, const void *publicData);
  1140. /*
  1141.  *    Light MetaHandler
  1142.  *    
  1143.  *    This metaHandler, if supplied, indicates that your renderer
  1144.  *    handles deferred transformation of lights within a scene.
  1145.  *    
  1146.  *    If an unsupported light is encountered, it is ignored.
  1147.  *
  1148.  *    OPTIONAL
  1149.  */
  1150.  
  1151. enum {
  1152.     kQ3XMethodTypeRendererSubmitLightMetaHandler = FOUR_CHAR_CODE('rdlg')
  1153. };
  1154.  
  1155. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitLightMetaHandlerMethod )(TQ3ObjectType lightType);
  1156. /*
  1157.  *    The TQ3XRendererSubmitLightMetaHandlerMethod switches on lightType
  1158.  *    of kQ3LightTypeFoo and returns methods of type:
  1159.  */
  1160. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitLightMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3LightObject light, const void *publicData);
  1161. /*
  1162.  *
  1163.  *    Update methods
  1164.  *
  1165.  *    They are called whenever the state has changed. If the renderer supports
  1166.  *    the RendererPush and RendererPop methods, it must maintain its own state
  1167.  *    stack. Updates are not called for changed data when the view stack is
  1168.  *    popped.
  1169.  *
  1170.  *    See the comments for the RendererPush and RendererPop methods above
  1171.  *    for an example of how data is updated.
  1172.  *
  1173.  */
  1174. /*
  1175.  *    Style
  1176.  */
  1177.  
  1178. enum {
  1179.     kQ3XMethodTypeRendererUpdateStyleMetaHandler = FOUR_CHAR_CODE('rdyu')
  1180. };
  1181.  
  1182. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateStyleMetaHandlerMethod )(TQ3ObjectType styleType);
  1183. /*
  1184.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on styleType
  1185.  *    of kQ3StyleTypeFoo and returns methods of type:
  1186.  */
  1187. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateStyleMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1188. /*
  1189.  *    Attributes
  1190.  */
  1191.  
  1192. enum {
  1193.     kQ3XMethodTypeRendererUpdateAttributeMetaHandler = FOUR_CHAR_CODE('rdau')
  1194. };
  1195.  
  1196. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateAttributeMetaHandlerMethod )(TQ3AttributeType attributeType);
  1197. /*
  1198.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on attributeType
  1199.  *    of kQ3AttributeTypeFoo and returns methods of type:
  1200.  */
  1201. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateAttributeMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1202. /*
  1203.  *    Shaders
  1204.  */
  1205.  
  1206. enum {
  1207.     kQ3XMethodTypeRendererUpdateShaderMetaHandler = FOUR_CHAR_CODE('rdsu')
  1208. };
  1209.  
  1210. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateShaderMetaHandlerMethod )(TQ3ObjectType shaderType);
  1211. /*
  1212.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on shaderType
  1213.  *    of kQ3ShaderTypeFoo and returns methods of type:
  1214.  */
  1215. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateShaderMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3Object shaderObject);
  1216. /*
  1217.  *    Matrices
  1218.  */
  1219.  
  1220. enum {
  1221.     kQ3XMethodTypeRendererUpdateMatrixMetaHandler = FOUR_CHAR_CODE('rdxu')
  1222. };
  1223.  
  1224. typedef TQ3XMetaHandler                 TQ3XRendererUpdateMatrixMetaHandlerMethod;
  1225. /*
  1226.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on methods
  1227.  *    of the form kQ3MethodTypeRendererUpdateMatrixFoo:
  1228.  */
  1229.  
  1230. enum {
  1231.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorld = FOUR_CHAR_CODE('ulwx')
  1232. };
  1233.  
  1234.  
  1235. enum {
  1236.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverse = FOUR_CHAR_CODE('ulwi')
  1237. };
  1238.  
  1239.  
  1240. enum {
  1241.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverseTranspose = FOUR_CHAR_CODE('ulwt')
  1242. };
  1243.  
  1244.  
  1245. enum {
  1246.     kQ3XMethodTypeRendererUpdateMatrixLocalToCamera = FOUR_CHAR_CODE('ulcx')
  1247. };
  1248.  
  1249.  
  1250. enum {
  1251.     kQ3XMethodTypeRendererUpdateMatrixLocalToFrustum = FOUR_CHAR_CODE('ulfx')
  1252. };
  1253.  
  1254.  
  1255. enum {
  1256.     kQ3XMethodTypeRendererUpdateMatrixWorldToFrustum = FOUR_CHAR_CODE('uwfx')
  1257. };
  1258.  
  1259. /*
  1260.  *    and returns methods of type:
  1261.  */
  1262. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateMatrixMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3Matrix4x4 *matrix);
  1263.  
  1264.  
  1265. #if PRAGMA_ENUM_ALWAYSINT
  1266.     #pragma enumsalwaysint reset
  1267. #elif PRAGMA_ENUM_OPTIONS
  1268.     #pragma option enum=reset
  1269. #elif defined(PRAGMA_ENUM_PACK__QD3DRENDERER__)
  1270.     #pragma options(pack_enums)
  1271. #endif
  1272.  
  1273. #if PRAGMA_STRUCT_ALIGN
  1274.     #pragma options align=reset
  1275. #elif PRAGMA_STRUCT_PACKPUSH
  1276.     #pragma pack(pop)
  1277. #elif PRAGMA_STRUCT_PACK
  1278.     #pragma pack()
  1279. #endif
  1280.  
  1281. #ifdef PRAGMA_IMPORT_OFF
  1282. #pragma import off
  1283. #elif PRAGMA_IMPORT
  1284. #pragma import reset
  1285. #endif
  1286.  
  1287. #ifdef __cplusplus
  1288. }
  1289. #endif
  1290.  
  1291. #endif /* __QD3DRENDERER__ */
  1292.  
  1293.